package com.huangliusong.desigin.pattern.structual.flyweight;

import java.util.HashMap;
import java.util.Map;

/**
 * @author huangliusong
 * @since 2018/10/12
 * {@link }
 */
public class EmployeeFactory {
    private static final Map<String,Employee> EMPLOYEE_MAP=new HashMap<String, Employee>();
    public static Employee getManager(String department){
        Manager manager=(Manager)EMPLOYEE_MAP.get(department);
        if (manager==null){
            System.out.println("创建部门经理"+department);
            manager=new Manager(department);
            manager.setReportContent(department+"部门汇报：此次汇报内容是....");
            EMPLOYEE_MAP.put(department,manager);
        }
        return manager;
    }
}
